package com.wuwei.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @description: MyConfig <br>
 * @date: 2021/2/5 21:16 <br>
 * @author: wuwei666 <br>
 * @version: 1.0 <br>
 */
@Configuration
public class MyConfig {
    /**
     * 使用@LoadBalanced注解赋予RestTemplate负载均衡的能力
     */
    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
